package middleware

import (
	"gitee.com/chejiangyi/bsfgo/core/base2"
	"gitee.com/chejiangyi/bsfgo/core/utils"
	"github.com/gin-contrib/gzip"
	"github.com/gin-gonic/gin"
)

type GzipMiddleware struct{}

func (*GzipMiddleware) GetOrder() float64 {
	return -94
}
func (m *GzipMiddleware) Enabled() bool {
	return base2.BsfConfigInstance.GetGzipEnabled()
}
func (*GzipMiddleware) Middleware(r *gin.Engine) {
	// 2. 开启 Gzip 压缩（默认压缩级别）
	r.Use(gzip.Gzip(gzip.DefaultCompression))
	utils.LogUtil.Info("GzipMiddleware已开启,支持Gzip压缩")
}
